//
//  HHHttpEnv.h
//  HHNetworkKit
//
//  Created by chun.chen on 2021/8/17.
//  http 环境配置 读取配置文件BCHttpCom_Env

#import <Foundation/Foundation.h>
#import "HHNetworkKitHeader.h"

NS_ASSUME_NONNULL_BEGIN

@interface HHHttpEnv : NSObject

/// 环境变量，key-value，根据环境从主工程BCHttpCom_Env.json读取。0:线上,1:测试, 2:预发
@property (nonatomic, strong, readonly) NSDictionary *envMap;
/// api 接口
@property (nonatomic, strong, readonly) NSDictionary *apiMap;
///当前环境，默认0:线上 对应上方static定义
@property (nonatomic, assign, readonly) NSInteger currentEnv;
/// 接口host
@property (nonatomic, copy, readonly) NSString *httpApi_host;
/// 文件上传URL，一般是七牛地址
@property (nonatomic, copy, readonly) NSString *httpApi_fileHost;

/// 单例（兼容swift）
+ (instancetype)shared;
/// 切换环境，内部会刷新环境配置文件(envMap)
/// @param env 对应currentEnv
- (void)changeAppCurrentENV:(NSInteger)env;

/// 返回接口路径
/// @param key apiMap对应的key, 找不到则返回key
- (NSString *)mappingPath:(NSString *)key;

/// 当前环境对应角色
- (NSInteger)envRole;
///MARK: -分类服务器地址
/// 默认群组接口
- (NSString *)apiHost;
/// web服务地址
- (NSString *)webHost;
/// api 签名
- (NSString *)apiSignKey;
/// 参数签名
- (NSString *)paramsSignKey;

/// 环境app key
- (NSString *)emAppkey;

///MARK: - help
/// 合成路径
/// @param paths 路径集合
+ (NSString *)urlComposePath:(NSString * _Nullable)paths, ...;

/// 拼接params参数的熬url]
/// @param url url description
/// @param params params description
+ (NSString *)url:(NSString *)url compnentParams:(NSDictionary *)params;

@end


///MARK: - 环境宏定义
#define kHHHttpEnvApi       [HHHttpEnv shared].apiHost
#define kHHHttpEnvWeb     [HHHttpEnv shared].webHost

NS_ASSUME_NONNULL_END
